//
//  webViewPushDiscloseDetailsViewController.m
//  WisdomZhuHai
//
//  Created by BABLE on 15/4/23.
//  Copyright (c) 2015年 wyd. All rights reserved.
//

#import "webViewPushDiscloseDetailsViewController.h"
#import "ProtocolManager.h"
#import "TransforController.h"

@interface webViewPushDiscloseDetailsViewController ()<UITextViewDelegate>
@property (retain, nonatomic) IBOutlet UIButton *phoneButton;
@property (nonatomic,strong) Common *common;
@property (retain, nonatomic) IBOutlet UITextView *feedback;
@property (retain, nonatomic) IBOutlet UITextField *feedbackTitle;
@property (nonatomic,strong)NSString *superClassId;

@end

@implementation webViewPushDiscloseDetailsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self textViewDidChange:self.feedback];
    [self.view addSubview: [TransforController shardeInstanceOfNavigationBarAndStatusBarCoverViewWithY:-65]];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
//    UIImageView *phoneButtonImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_main_phone"]];
//    self.phoneButton.imageView = phoneButtonImage;
//style:UIBarButtonItemStyleBordered target:self action:@selector(call)];

}

-(void)getSuperClassId:(NSString *)id{
    self.superClassId = id;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
////输入框placehold显示与隐藏
//-(void)textViewDidChange:(UITextView *)textView
//{
//    self.feedback.text = textView.text;
//    [self textView:textView shouldChangeTextInRange:textView.selectedRange replacementText:textView.text];
//    if (self.feedback.text.length == 0) {
//        self.tips.hidden = NO;
//    }else{
//        self.tips.hidden = YES;
//    }
//}

//return键盘隐藏
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
    if ([text isEqualToString:@"\n"]) {
        [textView resignFirstResponder];
        return NO;
    }
    return YES;
}
+(void)feedbackWithTarget:(id)target selector:(SEL)sel msg:(NSString *)msg title:(NSString *)title specialId:(NSString *)id{
    
//    [[ProtocolManager shareInstance] feedBack:@"ANONYUSER" msg:msg OSversion:@"IOS" target:target selector:@selector(didFinishSend:)];
    //缺少爆料接口
}


- (void)dealloc {
    [_phoneButton release];
    [_feedback release];
    [_feedbackTitle release];
    [super dealloc];
}
- (IBAction)phoneButtonAction:(id)sender {
    [self.common callWithPhoneString:OKSERVICEPHONE inView:self.view];
}
- (IBAction)Submit:(id)sender {
    NSString *feedbackText = [self.feedback text];
    NSString *feedbackTitleText = [self.feedbackTitle text];
    if(feedbackText.length < 1 || [feedbackText isEqualToString:@""] || feedbackTitleText.length < 1 || [feedbackTitleText isEqualToString:@""]){
        [[Common shareInstance] showAlertViewWithTitle:nil text:@"您还未填写爆料的标题或详情 =。=" dismissTime:0.8];
    }else{
        [self.feedbackTitle resignFirstResponder];
        [self.feedback resignFirstResponder];
        [[Common shareInstance] showLoadingViewWithMessage:nil];
        [webViewPushDiscloseDetailsViewController feedbackWithTarget:self selector:@selector(didFinishLogin:) msg:feedbackText title:feedbackTitleText];
        [[Common shareInstance] showAlertViewWithTitle:nil text:@"您的爆料正在提交，十分感谢您的参与！^_^" dismissTime:0.8];
    }
}
- (void)viewDidUnload {
    [self setPhoneButton:nil];
    [self setFeedback:nil];
    [self setFeedbackTitle:nil];
    [super viewDidUnload];
}
@end
